<?php

class HTech_Form_Decorator_MatrixCellText extends Zend_Form_Decorator_Abstract
{
    protected $_format = '<input class="%s" type="text" name="%s" id="%s" value="%s" %s />';    
    
    public function render($content)
    {
        $element = $this->getElement();
        $id = $element->getId();
        $belongsTo = $element->getBelongsTo();
        $name = $belongsTo ? sprintf('%s[%s]',$belongsTo,$element->getName()) : $element->getName();
        $value = $element->getValue();
        $readonly = $element->getAttrib('readonly') ? 'readonly="readonly"' : '';
        return sprintf($this->_format,$this->getOption('class'),$name,$id,$value,$readonly);
    }
}
